<template>
<div class='page-container'>
  <div @click.stop="toggle" class="example">点击获取元素信息</div>
  <div>元素值：</div>
  <div v-for="(value, key, index) in elementData" :key="index">
    {{ index }}. {{ key }} - {{ value }}
  </div>
</div>
</template>

<script>
export default {
  data() {
    return {
      elementData: null
    };
  },
  mounted() {
    this.$nextTick(() => {});
  },
  //方法集合
  methods: {
    toggle() {
      this.elementData = this.$el.querySelector(".example");
      console.log(this.$el.querySelector(".example"));
    }
  }
};
</script>

<style lang='scss' scoped>
</style>
